package com.qf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.dao.mapper.QfCommentDao;
import com.qf.pojo.resVo.BaseResult;
import com.qf.pojo.resVo.QfCommentUserResp;
import com.qf.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    QfCommentDao qfCommentDao;

    @Override
    public BaseResult findCourseCommentByCourseId(Integer id, Integer page, Integer size) {
        //进行分页操作
        PageHelper.startPage(page,size);
        List<QfCommentUserResp> qfCommentUserResp = qfCommentDao.findCourseCommentByCourseId(id);
        PageInfo<QfCommentUserResp> of = PageInfo.of(qfCommentUserResp);
        return new BaseResult(1,"查询成功！",of.getList(),of.getTotal());
    }
}
